//
//  QSSegmentTitleView.h
//  QSSegmentViewControllerDemo
//
//  Created by apple on 2017/9/18.
//  Copyright © 2017年 apple. All rights reserved.
//

#import <UIKit/UIKit.h>

@class QSSegmentTitleView;

@protocol QSSegmentTitleViewDelegate <NSObject>

@optional

/**
 *  切换标题
 *
 *  @param titleView QSSegmentTitleView
 *  @param startIndex 切换前标题索引
 *  @param endIndex 切换后标题索引
 */
- (void)QSSegmentTitleView:(QSSegmentTitleView *)titleView startIndex:(NSInteger)startIndex endIndex:(NSInteger)endIndex;

@end

@interface QSSegmentTitleView : UIView
@property (nonatomic, weak) id<QSSegmentTitleViewDelegate>delegate;

/** 标题文字间距，默认20 */
@property (nonatomic, assign) CGFloat itemMargin;

/** 当前选中标题索引，默认0 */
@property (nonatomic, assign) NSInteger selectIndex;

/** 标题字体大小，默认15 */
@property (nonatomic, strong) UIFont *titleFont;

/** 标题选中字体大小，默认15 */
@property (nonatomic, strong) UIFont *titleSelectFont;

/** 标题正常颜色，默认black */
@property (nonatomic, strong) UIColor *titleNormalColor;

/** 标题选中颜色，默认red */
@property (nonatomic, strong) UIColor *titleSelectColor;

/** 指示器颜色，默认与titleSelectColor一样 */
@property (nonatomic, strong) UIColor *indicatorColor;

/** 指示器的图片 */
@property (nonatomic, strong) UIImage *indicatorImg;

/** 指示器的高度  默认：2.0 */
@property (nonatomic, assign) CGFloat indicatorHeight;

/** 自定义视图 */
@property (nonatomic, strong) UIView *customView;

/** 自定义视图高度，默认40.0 */
@property (nonatomic, assign) CGFloat customViewHeight;

/** 选项视图高度，默认40.0 */
@property (nonatomic, assign) CGFloat segmentViewHeight;

/** 分割线颜色，默认透明 */
@property (nonatomic, strong) UIColor *lineColor;

/** 按钮数组 */
@property (nonatomic, strong) NSMutableArray<UIButton *> *itemBtnArr;

/**
 *  初始化方法
 */
- (instancetype)initWithFrame:(CGRect)frame andTitleArray:(NSArray *)titleArray;
@end
